<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
    <base href="<%=basePath%>">
    <title>优标检测网</title>
    <!-- 浏览器上显示title 图标 icon图标 -->
	<link type="image/x-icon" rel="icon" href="<%=basePath %>resource/img/minilogo.png">

	<!-- 如果想让图标出现在收藏夹中，就：  -->
	<link type="image/x-icon" rel="shortcut icon" href="<%=basePath %>resource/img/minilogo.png">
	<link type="image/x-icon" rel="bookmark" href="<%=basePath %>resource/img/minilogo.png">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="优标">
	<meta http-equiv="description" content="优标">
    <link href="<%=basePath %>portal/css/main.css" type="text/css" rel="stylesheet">
    <link href="<%=basePath %>portal/css/datepickerbootstrap.css" type="text/css" rel="stylesheet">
    <!-- <link href="<%=basePath %>portal/css/dropzone.css" type="text/css" rel="stylesheet"> -->
    <link href="<%=basePath %>portal/js/res/uploadify/uploadify.css" rel="stylesheet" type="text/css" />
    <title>上传标准</title>
    <style type="text/css">
    	#file{border:2px dashed #0087F7;box-shadow: inset 0px 0px 1px 1px #e8e8e8;border-radius:5px;
    	min-height: 150px;padding:0;margin-bottom:5px;}
    	.PCFileUploadCompanyName{position:relative}
    	.RegMsg {
		    font-size: 12px;
		    color: #d14035;
		    position: absolute;
		    right: -90px;
		    bottom: 4px;
		}
		.PCFileUploadCover{z-index:999;height:519px;}
		.PCFileUploadCompanyDes{width:671px;height:265px;}
		.dropzone1 .dz-preview{margin:5px;}
		.uploadtips{margin-left:280px;margin-bottom:10px;}
		#errmsg{margin-left:132px;margin-bottom:30px;font-size:13px;color:#f00;}
		.uploadcls{margin:0 auto;width:380px;}
    </style>
</head>
<body>
<%@include file="p_head.jsp"%>
<div class="NCContent">
    <div class="NCNewsHead">
        <div class="MainPage">
            <div class="NCMain">
                <h2 class="NCHeadWord">质量控制 / Quality Control</h2>
            </div>
        </div>
    </div>
    <div class="NCNewsList">
        <div class="MainPage">
            <div class="NCMain">
                <div class="NCNewsListContent">
                    <div class="QCTitleContentHead">上传企业监测报告</div>
                    <div class="PCFileUploadBody">
                    	<c:if test="${canMultiUpload=='false'}">
                        <div class="PCFileUploadCover">
                            <div class="PCFUAlert">
                            </div>
                        </div>
                        </c:if>
                        <div class="PCFileUploadTabBtn2">
                            <a class="PCFileUploadBtn1" href="<%=basePath%>report_showUpload.action"></a>
                            <a class="PCFileUploadBtn2"></a>
                        </div>
                        <form method="post" action="<%=basePath%>report_doMultiUpload.action?compName=1"+ id="reportForm2" enctype="multipart/form-data">
                        	<input type="hidden" id="compId" name="compId" value="${compId}"/>
	                        <div class="PCFileUploadCompanyName"><span>企业名称/企业编号</span>
	                        <input type="text" id="compName" name="compName"/>
	                        <span style="display:none" class="RegMsg">*企业名称不能为空</span></div>
							<div class="uploadtips">请选择要上传的报告（请先输入企业名称或企业编号）</div>
	                        <!-- <div id="file" name="file" class="PCFileUploadCompanyDes dropzone1"></div> -->
	                        <div class="uploadcls">
	                        <input type="file" name="uploadify" id="uploadify" disabled="disabled"/>
	                        </div>
	                        <div id="errmsg"></div>
	                        <span class="BtnCss PCFileUploadBtn toupload">上传</span>
	                        <div style="padding-bottom:30px;"></div>
	                        <div style="clear:both"></div>
                        </form>
                    </div>
                    <div class="NCNewsListContentFoot"></div>
                </div>

            </div>
        </div>
    </div>
</div>
<%@include file="p_foot.jsp"%>
<input type="hidden" name="basePath" id="basePath" value="<%=basePath%>"/>
</body>
<script src="<%=basePath %>portal/js/res/jquery-1.4.2.min.js"></script>
<script src="<%=basePath %>portal/js/res/responsiveslides.min.js"></script>
<script src="<%=basePath %>portal/js/res/zebra_datepicker.src.js"></script>

<script src="<%=basePath %>portal/js/page/base.js"></script>
<!-- <script src="<%=basePath %>portal/js/res/dropzone.js"></script> -->
<script src="<%=basePath %>portal/js/res/uploadify/jquery.uploadify.min.js"></script> 
<script>

//var myDropzone;

$("#compName").blur(function(){
	$.ajax({
		url:$("#basePath").val() + "report_checkCompName.action?compName=" + encodeURI(encodeURI($("#compName").val())),
		type:'GET',
		success:function(mydata){
			switch(mydata.result) {
			case 0:
				$("#compId").val(mydata.data.compId);
				$("#compName").val(mydata.data.compName);
				$("#compName").parent().find(".RegMsg").hide();
				//initzone();
				init();
				$("#submitBtn").val("上传");
				break;
			case 1:
			case 2:
				$("#compName").parent().find(".RegMsg").html(mydata.msg).show();
				break;
			}
		}
	});
});

    $(document).ready(function() {  
    	$("#uploadify").uploadify({"disabled": true,buttonText: "请选择文件",width: 120});
	});
	
	function init() {
		$("#uploadify").uploadify({ 
	        height: 30,
	        swf: "<%=basePath %>portal/js/res/uploadify/uploadify.swf",
	        uploader: "<%=basePath%>report_doMultiUpload.action",
	        width: 120,
	        buttonText: "请选择文件",
	        fileTypeExts: "*.pdf",
	        fileSizeLimit: "10MB",
	        formData: {"compId":$("#compId").val()},
	        multi: true,
	        auto: false,
	        onUploadComplete: function(file) {
	            //$("#errmsg").html(file.name + ' 上传完成！');
	        }
	    });  
	}
    
    $(".returnBtn").click(function(){
		location.href = "<%=basePath%>report_index.action";
	});
	
	$(".toupload").click(function(){
		$('#uploadify').uploadify('upload','*');
	});

/*$("#uploadify").click(function() {
	if ($("#compName").val() == "")
	{
		$("#errmsg").html("请输入企业名称或企业编号");
	} else {
		$("#errmsg").hide();
	}
});*/



/*function initzone() {
	var browserVersion = window.navigator.userAgent.toUpperCase();
	if (browserVersion.indexOf("MSIE") > -1 && browserVersion.indexOf("MSIE 10") == -1) {
		uploadUrl = "<%=basePath%>report_doMultiUpload.action?browser=ie&compId=" + $("#compId").val();
	} else {
		uploadUrl = "<%=basePath%>report_doMultiUpload.action?compId=" + $("#compId").val()
	}
	myDropzone = new Dropzone("div#file", {
	    url: uploadUrl,
	    paramName: "file",
	    maxFiles: 10,
	    maxFilesize: 50,
	    acceptedFiles: ".pdf",
	    addRemoveLinks:false,
	    autoProcessQueue: true,//自动上传
		dictDefaultMessage: "请选择要上传的报告",
		dictInvalidFileType: "只能上传PDF类型文件",
		dictFileTooBig: "文件大小不能大于80M",
		dictRemoveFile: "移除文件",
		dictResponseError: "文件上传出错",
		dictCancelUpload: "取消",
		dictFallbackMessage: "",
		dictFallbackText: "",
	    init: function() {
	            this.on("error", function(file) {
	                 //alert("文件上传失败!");
	                 //this.removeFile(file);
	            });
				this.on("success", function(file, data) {
					json = JSON.parse(data);
					if (json.result != 0) {
						$("#errmsg").html(file.name+" 上传失败").show();
						this.removeFile(file);
					} else if (json.result == 0) {
						$("#errmsg").hide();
					}
	            });
	            this.on("maxfilesexceeded", function(file) {
	                this.removeFile(file);
	            });
	            this.on("addedfile", function(file) {
	               if (file.type != "application/pdf"){
						this.removeFile(file); 
					} 
	            });
	        }
	});
}*/
</script>
</html>